package cn.xyfmzmy.timingwheel;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;

public class Demo {

    public static void main(String[] args) throws InterruptedException {
        TimerWheel timerWheel = new TimerWheel();
        CountDownLatch countDownLatch = new CountDownLatch(10000);
        AtomicInteger count = new AtomicInteger();
        for(int i = 0;i < 10; i++){
            new Thread(()->{
                for(int j=0;j<1000;j++){
                    timerWheel.addDelayTask(()->{
                        System.out.println(count.incrementAndGet());
                        countDownLatch.countDown();
                    },100);
                }
                System.out.println("添加结束");
            }).start();
        }
        countDownLatch.await();
        System.out.println("执行完毕");
    }
}
